<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SemOpt: src/Argument.cpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">SemOpt
   &#160;<span id="projectnumber">0.2alpha5-SCC</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('Argument_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">src/Argument.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="Argument_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00009"></a>00009 <span class="preprocessor">#include &quot;Argument.h&quot;</span>
<a name="l00010"></a>00010 
<a name="l00017"></a><a class="code" href="classArgument.html#aa312e97860b77b102739b7c836f7c253">00017</a> <a class="code" href="classArgument.html#aa312e97860b77b102739b7c836f7c253" title="Constructor.">Argument::Argument</a>(<span class="keywordtype">string</span> name, <span class="keywordtype">int</span> num, <a class="code" href="classAF.html" title="Class encompassing an Argumentation Framework.">AF</a> *theaf)
<a name="l00018"></a>00018 {
<a name="l00019"></a>00019         this-&gt;name = name;
<a name="l00020"></a>00020         this-&gt;number = num;
<a name="l00021"></a>00021         this-&gt;af = theaf;
<a name="l00022"></a>00022         this-&gt;attackers = <span class="keyword">new</span> <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00023"></a>00023         this-&gt;attacks = <span class="keyword">new</span> <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00024"></a>00024 }
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 Argument::~Argument()
<a name="l00027"></a>00027 {
<a name="l00028"></a>00028         <span class="comment">// TODO Auto-generated destructor stub</span>
<a name="l00029"></a>00029 }
<a name="l00030"></a>00030 
<a name="l00035"></a><a class="code" href="classArgument.html#a95323c2bfcbb4c0d494acc13f76cc28a">00035</a> <span class="keywordtype">string</span> <a class="code" href="classArgument.html#a95323c2bfcbb4c0d494acc13f76cc28a" title="Method returning the name of the argument.">Argument::getName</a>()<span class="keyword"> const</span>
<a name="l00036"></a>00036 <span class="keyword"></span>{
<a name="l00037"></a>00037         <span class="keywordflow">return</span> this-&gt;name;
<a name="l00038"></a>00038 }
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="keywordtype">string</span> Argument::print()<span class="keyword"> const</span>
<a name="l00041"></a>00041 <span class="keyword"></span>{
<a name="l00042"></a>00042         <span class="keywordtype">string</span> res = <span class="stringliteral">&quot;(&quot;</span> + <a class="code" href="classArgument.html#a95323c2bfcbb4c0d494acc13f76cc28a" title="Method returning the name of the argument.">getName</a>() + <span class="stringliteral">&quot;, &quot;</span>;
<a name="l00043"></a>00043         ostringstream convert;
<a name="l00044"></a>00044         convert &lt;&lt; <a class="code" href="classArgument.html#aa26daf8c55afbe7d0970b23fbdbc96ca" title="Method returning the unique integer identifier of this argument.">getNumber</a>();
<a name="l00045"></a>00045         res.append(convert.str());
<a name="l00046"></a>00046         res += <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00047"></a>00047         <span class="keywordflow">return</span> res;
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049 
<a name="l00054"></a><a class="code" href="classArgument.html#aa26daf8c55afbe7d0970b23fbdbc96ca">00054</a> <span class="keywordtype">int</span> <a class="code" href="classArgument.html#aa26daf8c55afbe7d0970b23fbdbc96ca" title="Method returning the unique integer identifier of this argument.">Argument::getNumber</a>()<span class="keyword"> const</span>
<a name="l00055"></a>00055 <span class="keyword"></span>{
<a name="l00056"></a>00056         <span class="keywordflow">return</span> this-&gt;number;
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058 
<a name="l00064"></a><a class="code" href="classArgument.html#a0f0599741585650c3bf44714d6a06df9">00064</a> <a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> <a class="code" href="classArgument.html#a0f0599741585650c3bf44714d6a06df9" title="Method for determining a propositional variable representing that this argument should be labelled as...">Argument::InVar</a>()
<a name="l00065"></a>00065 {
<a name="l00066"></a>00066         <span class="keywordflow">return</span> this-&gt;number + 1;
<a name="l00067"></a>00067 }
<a name="l00068"></a>00068 
<a name="l00074"></a><a class="code" href="classArgument.html#a22f8d770c9dabeee5400104f11cd94e9">00074</a> <a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> <a class="code" href="classArgument.html#a22f8d770c9dabeee5400104f11cd94e9" title="Method for determining a propositional variable representing that this argument should be labelled as...">Argument::OutVar</a>()
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076         <span class="keywordflow">return</span> this-&gt;number + 1 + this-&gt;af-&gt;<a class="code" href="classAF.html#a48e30f0573d51a9995093644bb19bb33" title="Returns the number of arguments.">numArgs</a>();
<a name="l00077"></a>00077 }
<a name="l00078"></a>00078 
<a name="l00084"></a><a class="code" href="classArgument.html#a6b6fc0ba74c480e9186fe2860487008c">00084</a> <a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> <a class="code" href="classArgument.html#a6b6fc0ba74c480e9186fe2860487008c" title="Method for determining a propositional variable representing that this argument should be labelled as...">Argument::UndecVar</a>()
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086         <span class="keywordflow">return</span> this-&gt;number + 1 + 2 * this-&gt;af-&gt;<a class="code" href="classAF.html#a48e30f0573d51a9995093644bb19bb33" title="Returns the number of arguments.">numArgs</a>();
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00094"></a><a class="code" href="classArgument.html#a19efdd00a8dbf15271a311a720e300a4">00094</a> <a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> <a class="code" href="classArgument.html#a19efdd00a8dbf15271a311a720e300a4" title="Method for determining **the negation** of the propositional variable representing that this argument...">Argument::NotInVar</a>()
<a name="l00095"></a>00095 {
<a name="l00096"></a>00096         <span class="keywordflow">return</span> NOT(this-&gt;<a class="code" href="classArgument.html#a0f0599741585650c3bf44714d6a06df9" title="Method for determining a propositional variable representing that this argument should be labelled as...">InVar</a>());
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00104"></a><a class="code" href="classArgument.html#a0db86f8dcbb8aed850aa5d7c0a689372">00104</a> <a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> <a class="code" href="classArgument.html#a0db86f8dcbb8aed850aa5d7c0a689372" title="Method for determining **the negation** of the propositional variable representing that this argument...">Argument::NotOutVar</a>()
<a name="l00105"></a>00105 {
<a name="l00106"></a>00106         <span class="keywordflow">return</span> NOT(this-&gt;<a class="code" href="classArgument.html#a22f8d770c9dabeee5400104f11cd94e9" title="Method for determining a propositional variable representing that this argument should be labelled as...">OutVar</a>());
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 
<a name="l00114"></a><a class="code" href="classArgument.html#a0b8fb438e4de8a4348e754714363fbf3">00114</a> <a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> <a class="code" href="classArgument.html#a0b8fb438e4de8a4348e754714363fbf3" title="Method for determining **the negation** of the propositional variable representing that this argument...">Argument::NotUndecVar</a>()
<a name="l00115"></a>00115 {
<a name="l00116"></a>00116         <span class="keywordflow">return</span> NOT(this-&gt;<a class="code" href="classArgument.html#a6b6fc0ba74c480e9186fe2860487008c" title="Method for determining a propositional variable representing that this argument should be labelled as...">UndecVar</a>());
<a name="l00117"></a>00117 }
<a name="l00118"></a>00118 
<a name="l00124"></a><a class="code" href="classArgument.html#a44a615fda392650c5dc42036d9f4b1fc">00124</a> <span class="keywordtype">bool</span> <a class="code" href="classArgument.html#a44a615fda392650c5dc42036d9f4b1fc" title="Overloading of the == operator.">Argument::operator==</a>(<span class="keyword">const</span> <a class="code" href="classArgument.html" title="Class representing an Argument.">Argument</a> &amp;other)<span class="keyword"> const</span>
<a name="l00125"></a>00125 <span class="keyword"></span>{
<a name="l00126"></a>00126         <span class="keywordflow">if</span> (this-&gt;name == other.<a class="code" href="classArgument.html#a95323c2bfcbb4c0d494acc13f76cc28a" title="Method returning the name of the argument.">getName</a>() &amp;&amp;
<a name="l00127"></a>00127                         this-&gt;number == other.<a class="code" href="classArgument.html#aa26daf8c55afbe7d0970b23fbdbc96ca" title="Method returning the unique integer identifier of this argument.">getNumber</a>())
<a name="l00128"></a>00128                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00129"></a>00129         <span class="keywordflow">else</span>
<a name="l00130"></a>00130                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00131"></a>00131 }
<a name="l00132"></a>00132 
<a name="l00138"></a><a class="code" href="classArgument.html#a6f035645e46115d0f5a3f3ca98461bce">00138</a> <span class="keywordtype">bool</span> <a class="code" href="classArgument.html#a6f035645e46115d0f5a3f3ca98461bce" title="Overloading of the != operator.">Argument::operator!=</a>(<span class="keyword">const</span> <a class="code" href="classArgument.html" title="Class representing an Argument.">Argument</a> &amp;other)<span class="keyword"> const</span>
<a name="l00139"></a>00139 <span class="keyword"></span>{
<a name="l00140"></a>00140         <span class="keywordflow">if</span> (this-&gt;name == other.<a class="code" href="classArgument.html#a95323c2bfcbb4c0d494acc13f76cc28a" title="Method returning the name of the argument.">getName</a>() &amp;&amp;
<a name="l00141"></a>00141                         this-&gt;number == other.<a class="code" href="classArgument.html#aa26daf8c55afbe7d0970b23fbdbc96ca" title="Method returning the unique integer identifier of this argument.">getNumber</a>())
<a name="l00142"></a>00142                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00143"></a>00143         <span class="keywordflow">else</span>
<a name="l00144"></a>00144                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146 
<a name="l00152"></a><a class="code" href="classArgument.html#a8a5cddf583929099b8228ed9300e2759">00152</a> <span class="keywordtype">void</span> <a class="code" href="classArgument.html#a8a5cddf583929099b8228ed9300e2759" title="Method for adding an attacks originated from this argument.">Argument::add_attacks</a>(<a class="code" href="classArgument.html" title="Class representing an Argument.">Argument</a> *arg)
<a name="l00153"></a>00153 {
<a name="l00154"></a>00154         this-&gt;attacks-&gt;<a class="code" href="classSetArguments.html#a989d8986ecf49baa0dc982766c0a5df4" title="Add an argument to the set.">add_Argument</a>(arg);
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 
<a name="l00162"></a><a class="code" href="classArgument.html#ad295236fa6d55121e37e90ec05289c8c">00162</a> <span class="keywordtype">void</span> <a class="code" href="classArgument.html#ad295236fa6d55121e37e90ec05289c8c" title="Method for adding an attacker.">Argument::add_attackers</a>(<a class="code" href="classArgument.html" title="Class representing an Argument.">Argument</a> *arg)
<a name="l00163"></a>00163 {
<a name="l00164"></a>00164         this-&gt;attackers-&gt;<a class="code" href="classSetArguments.html#a989d8986ecf49baa0dc982766c0a5df4" title="Add an argument to the set.">add_Argument</a>(arg);
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166 
<a name="l00172"></a><a class="code" href="classArgument.html#aaee498e60e009e6fdb455decb25fa96d">00172</a> <span class="keywordtype">void</span> <a class="code" href="classArgument.html#aaee498e60e009e6fdb455decb25fa96d" title="Method for removing an attacks originated from this argument.">Argument::remove_attacks</a>(<a class="code" href="classArgument.html" title="Class representing an Argument.">Argument</a> *arg)
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174         this-&gt;attacks-&gt;<a class="code" href="classSetArguments.html#a11b8009ff9cd0961731eac8ee95c4b55" title="Remove an argument from this set.">remove</a>(arg);
<a name="l00175"></a>00175 }
<a name="l00176"></a>00176 
<a name="l00182"></a><a class="code" href="classArgument.html#afbd830039143306df9ea249a8e3e8882">00182</a> <span class="keywordtype">void</span> <a class="code" href="classArgument.html#afbd830039143306df9ea249a8e3e8882" title="Method for removing an attacker.">Argument::remove_attackers</a>(<a class="code" href="classArgument.html" title="Class representing an Argument.">Argument</a> *arg)
<a name="l00183"></a>00183 {
<a name="l00184"></a>00184         this-&gt;attackers-&gt;<a class="code" href="classSetArguments.html#a11b8009ff9cd0961731eac8ee95c4b55" title="Remove an argument from this set.">remove</a>(arg);
<a name="l00185"></a>00185 }
<a name="l00186"></a>00186 
<a name="l00191"></a><a class="code" href="classArgument.html#ae8c77c2d0676845f250d77dfb3ce4378">00191</a> <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> *<a class="code" href="classArgument.html#ae8c77c2d0676845f250d77dfb3ce4378" title="Method returning the set of attackers.">Argument::get_attacks</a>()
<a name="l00192"></a>00192 {
<a name="l00193"></a>00193         <span class="keywordflow">return</span> this-&gt;attacks;
<a name="l00194"></a>00194 }
<a name="l00195"></a>00195 
<a name="l00200"></a><a class="code" href="classArgument.html#aa57914a9e5a27af3c3dbd1db8c0d3602">00200</a> <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> *<a class="code" href="classArgument.html#aa57914a9e5a27af3c3dbd1db8c0d3602" title="Method returning the set of attacked arguments.">Argument::get_attackers</a>()
<a name="l00201"></a>00201 {
<a name="l00202"></a>00202         <span class="keywordflow">return</span> this-&gt;attackers;
<a name="l00203"></a>00203 }
<a name="l00204"></a>00204 
<a name="l00209"></a><a class="code" href="classArgument.html#ad2e1361e07c13c5ec5784d33e58ef76e">00209</a> <a class="code" href="classAF.html" title="Class encompassing an Argumentation Framework.">AF</a> *<a class="code" href="classArgument.html#ad2e1361e07c13c5ec5784d33e58ef76e" title="Method returning the AF to which this argument belongs.">Argument::get_af</a>()
<a name="l00210"></a>00210 {
<a name="l00211"></a>00211         <span class="keywordflow">return</span> this-&gt;af;
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213 
<a name="l00224"></a><a class="code" href="Argument_8cpp.html#a76ef732a0021f3ac6698582cf94a079e">00224</a> ostream&amp; <a class="code" href="Argument_8cpp.html#a76ef732a0021f3ac6698582cf94a079e">operator&lt;&lt;</a>(ostream&amp; f, <span class="keyword">const</span> <a class="code" href="classArgument.html" title="Class representing an Argument.">Argument</a>&amp; arg){
<a name="l00225"></a>00225         f &lt;&lt; arg.<a class="code" href="classArgument.html#a95323c2bfcbb4c0d494acc13f76cc28a" title="Method returning the name of the argument.">getName</a>() &lt;&lt; <span class="stringliteral">&quot; (&quot;</span> &lt;&lt; arg.<a class="code" href="classArgument.html#aa26daf8c55afbe7d0970b23fbdbc96ca" title="Method returning the unique integer identifier of this argument.">getNumber</a>() &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00226"></a>00226         <span class="keywordflow">return</span> f;
<a name="l00227"></a>00227 }
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="Argument_8cpp.html">Argument.cpp</a>      </li>

    <li class="footer">Generated on Fri Jan 17 2014 11:47:51 for SemOpt by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
